package com.janko.eurekacustomer.rabbitmq;

import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Author nyk
 * @Date 2022/4/9 16:54
 * @Version 1.0
 * @Desc topic模式的消息队列接受者
 */
@Component
public class TopicReceiver {

    @RabbitHandler
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "topic.man", autoDelete = "false"),
            exchange = @Exchange(value = "topicExchange", delayed = "true")))
    public void topicManProcess(Map testMessage) {
        System.out.println("TopicManReceiver消费者收到消息  : " + testMessage.toString());
    }

    @RabbitHandler
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "topic.woman", autoDelete = "false"),
            exchange = @Exchange(value = "topicExchange", delayed = "true")))
    public void topicWomenProcess(Map testMessage) {
        System.out.println("TopicManReceiver消费者收到消息  : " + testMessage.toString());
    }
}
